<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('student/index')}">所有班级</a></li>
        <li><a href="{:url('student/add')}">添加班级</a></li>
        <li class="active"><a>编辑班级</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form margin-top-20" action="{:url('student/editPost')}" method="post">
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>头像</label>
            <div class="col-md-6 col-sm-10">
                <input id="photo-1" type="hidden" name="image" >
                <input id="photo-1-name" type="text" name="photo_name" title="图片名称" value="{$student.image}">
                <img id="photo-1-preview" src="/upload/{$student.image}" width="50px">
                <a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>学生姓名</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="name" value="{$student.name}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>性别</label>
            <div class="col-md-6 col-sm-10">
                <input type="radio" name="sex"  value="男" {if $stu.sex == '男' } checked {/if}>男
                <input type="radio" name="sex"  value="女" {if $stu.sex == '女' } checked {/if}>女

            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">年龄</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-address" name="age" value="{$student.age}">
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">手机号</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-moblie" name="idcard" value="{$student.moblie}">
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">身份证号</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-idcard" name="idcard" value="{$student.idcard}">
            </div>
        </div>
        <div class="form-group">
            <label for="selectSchool" class="col-sm-2 control-label">学校</label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control" id="selectSchool" >
                    <option value="" selected>请选择</option>
                    <volist name='school' id='vo'>
                        <if $school_id == $vo.id>
                            <option value="{$vo.id}" selected>{$vo.name}</option>
                            <else>
                                <option value="{$vo.id}">{$vo.name}</option>
                            </else>
                        </if>
                    </volist>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="room" class="col-sm-2 control-label">班级</label>
            <div class="col-md-6 col-sm-10">
                <select name="cid" class="form-control" id="room">
                    <option value="">请选择班级</option>
                    <volist name='room' id='vo'>
                        <if $student.cid == $vo.id>
                            <option value="{$vo.id}"  selected="selected" >{$vo.name}</option>
                            <else>
                                <option value="{$vo.id}">{$vo.name}</option>
                            </else>
                        </if>
                    </volist>
                </select>
            </div>
        </div>
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary   js-ajax-submit">修改</button>
            <input type="hidden" name="id" value="{$student.id}">
            <a class="btn btn-default" href="{:url('student/index')}">返回</a>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js">
</script>
<script>
    $(function () {
        $('#selectSchool').change('click',function () {
            var schoolId = $('#selectSchool').val();
            $.ajax({
                url: "{:url('student/getRoombySchool')}",
                type: "POST",
                data: {school_id: schoolId},
                success: function (res) {
                    $('#room').html(res);
                    form.render();
                }
            })
        })
    })

</script>
</body>
</html>